<%-- 
    Document   : article
    Created on : Oct 26, 2012, 9:45:32 AM
    Author     : HAITHE
--%>
<%@page import="com.sun.xml.internal.bind.v2.model.impl.ModelBuilder"%>
<script language="javascript">
    function confirmDelete()
    {
        if(confirm("Do you want to Delete ?")==true)
        {
            return true;
        }
        return false;
    }  
</script>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-bean"  prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<jsp:useBean id="articleModel" class="Model.ArticleModel"/>
<c:set var="articles" value="${articleModel.allArticle}"/>

<h3>Article</h3>
<font color="red">${ error }</font>
<font color="blue">${ success }</font>
<html:form action="/deleteNArticleAction">
    <table class="data">
        <tr class="data">
            <th class="data" width="10px">Id</th>
            <th class="data">Category</th>
            <th class="data">Title</th>
            <th class="data">Rate</th>
            <th class="data" width="75px">Action</th>
        </tr>
        <c:forEach var="article" items="${articles}">  
            <tr class="data">
                <td class="data">${article.id}</td>
                <td class="data">${article.category_id}</td>
                <td class="data">${article.title}</td>
                <td class="data">${article.rate}</td>
                <td class="data" width="75px">
            <center>
                &nbsp;<html:link action="/articleActionNoForm?action=edit&id=${article.id}"><img src="mos-css/img/_edit.png" width="16px" height="16px"></html:link>
                <html:multibox value="${ article.id}" property="articleIds" />&nbsp;

            </center>
        </td>
    </tr>
</c:forEach>
</table>
<html:link action="/NewArticle" styleClass="button">New Article</html:link>
<html:submit value="Delete" styleClass="button" onclick="return confirmDelete();"/>  
</html:form>